/*
  Name: DeadProxyClientMessageLog.h
  Copyright:
  Author: Carl Chatfield
  Date: 18/02/08 18:13
  Description: Stores all messages recved and sent by the client
*/

#ifndef __DEADPROXYCLIENTMESSAGELOG_h__
#define __DEADPROXYCLIENTMESSAGELOG_h__

#ifdef __BORLANDC__
	#pragma hdrstop
#endif

#ifndef WX_PRECOMP
	#include <wx/wx.h>
#else
	#include <wx/wxprec.h>
#endif

class Message
{
    private:
        wxString LogString;
    public:
        int Type;
        wxString Time;
        wxString Sender;
        wxString Text;
        int sendrecv;
        wxString * GetString();
        Message(wxString * sender, wxString * text, int type);
};
WX_DECLARE_OBJARRAY(Message, ArrayOfMessages);

class ChannelLog
{
    private:
        ArrayOfMessages * Messages;
        wxString ChannelName;
        int NewMessages;
        wxMutex * mutex;
        int channelId;
    public:
        int GetNewMessageCount();
        int GetChannelId();
        void ResetMessageCount();
        wxString * AddMessage(wxString * sender, wxString * text, int type);
        wxString * GetMessageString(int logpos);
        wxString * GetString();
        wxArrayString * GetMessageInfo(int logpos);
        wxArrayString * GetListBoxArray();
        void ClearLog();
        ChannelLog(wxString * ChanName, int chanid);
        virtual ~ChannelLog();
};
WX_DECLARE_OBJARRAY(ChannelLog, ArrayOfChannelLogs);

class MessageLog
{
    private:
        ArrayOfChannelLogs * Logs;
        wxMutex * mutex;
	public:
        struct AddMessageStruct
        {
            wxString * ChannelName;
            wxString * MessageString;
            int Channel;
        };
        bool ClearLog(int pos);
        int GetCount();
        //void ClearAllLogs();
        AddMessageStruct * AddMessage(wxString * sender, wxString * text, int channelid, int type);
        wxString * OpenChannel(wxString * ChannelName, int channelid);
        wxArrayString * GetListBoxArray();
        wxArrayString * GetMessageBoxArray(int pos);
        wxArrayString * GetMessageInfo(int channelpos, int logpos);
        
        MessageLog();
        virtual ~MessageLog();
};

#endif
